#!/bin/sh
#
# GeoGebra - Dynamic Mathematics for Everyone
# http://www.geogebra.org
#
# This file is part of GeoGebra.
#
# This program is free software; you can redistribute it and/or modify it 
# under the terms of the GNU General Public License as published by 
# the Free Software Foundation.
#
# Script for generating properties files which allow translators
# to display property keys insted of values. The key is prefixed
# with filename and all %0,%1 references are appended to the end.
#
# Example:
#
# CircleWithCenterAandRadiusB=Circle with center %0 and radius %1
#
# goes to
#
# CircleWithCenterAandRadiusB=plain_CircleWithCenterAandRadiusB:%0,%1
#
# @author Zbynek Konecny <zbynek@geogebra.org>

cd ../geogebra/properties
for f in menu colors symbols error command plain
	do	
		cat $f.properties |grep =|grep -v "#" |grep -v "%0" | sed "s/\([^=]*\)=\(.*\)/\1=\1_$f/" > $f"_ia.properties"
		cat $f.properties |grep =|grep  "%0" |grep -v "%1" | sed "s/\([^=]*\)=\(.*\)/\1=\1_$f:%0/" >> $f"_ia.properties"
		cat $f.properties |grep =|grep  "%1" |grep -v "%2" | sed "s/\([^=]*\)=\(.*\)/\1=\1_$f:%0,%1/" >> $f"_ia.properties"
		cat $f.properties |grep =|grep  "%2" |grep -v "%3" | sed "s/\([^=]*\)=\(.*\)/\1=\1_$f:%0,%1,%2/" >> $f"_ia.properties"
		cat $f.properties |grep =|grep  "%3" |grep -v "%4" | sed "s/\([^=]*\)=\(.*\)/\1=\1_$f:%0,%1,%2,%3/" >> $f"_ia.properties"
		cat $f.properties |grep =|grep  "%4" |grep -v "#" | sed "s/\([^=]*\)=\(.*\)/\1=\1_$f:%0,%1,%2,%3/" >> $f"_ia.properties"
	done
